package demo13.Practice01;

public class DuckSimulator {
	public static void main(String[] args) {
		DuckSimulator duckSimulator =new DuckSimulator();//创建模拟器实例
		duckSimulator.simulator();//
		
		
	/*	鸭子模拟器测试开始
		橡皮鸭子吱吱叫
		绿头鸭呱呱叫
		绿头鸭呱呱叫
		大鹅叫
		*/

		
	}

	public void simulator(){
		Quackable mallardDuck = new MallardDuck();//鸭子实例
		Quackable redheadDuck = new MallardDuck();
		Quackable rubberDuck = new RubberDuck();
		
		//适配器包装大鹅
		Quackable goose = new GooseAdapter(new Goose());
		
		System.out.println("鸭子模拟器测试开始");
		simulator(rubberDuck);
		simulator(redheadDuck);
		simulator(mallardDuck);
		simulator(goose);
	}
	
	public void simulator(Quackable duck){//重载simulator（）方法
				duck.query();//多态实现
			}
}
